class User < ActiveRecord::Base
  acts_as_authorization_subject
  #acts_as_authorization_object
  validates_presence_of :name, :first_name, :birth_date, :hiring_date, :adress, :zip_code, :city
  acts_as_authentic
  validates_uniqueness_of :name

  #has_many :roles_users
  #has_many :roles, :through => :roles_users

  has_and_belongs_to_many :roles

  def deliver_password_reset_instructions!
    reset_perishable_token!
    UserMailer.deliver_password_reset_instructions(self)
  end
end
